
package com.joysuch.wwyt.monitoringcenter.service;

import com.joysuch.wwyt.bp.entity.InspectExceptionAlarmMesage;
import com.joysuch.wwyt.core.bean.SimpleSelectListBean;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.exception.ApiBusinessException;
import com.joysuch.wwyt.mh.entity.MhAlarmMessage;
import com.joysuch.wwyt.monitoringcenter.bean.*;
import com.joysuch.wwyt.risk.entity.RiskEvaluationAlarmMesage;
import com.joysuch.wwyt.workflow.bean.ScreenColumnConfigBean;
import com.joysuch.wwyt.workflow.bean.ScreenConfigListBean;
import com.joysuch.wwyt.workflow.bean.ScreenConfigListReturnBean;
import com.joysuch.wwyt.workflow.bean.WorkFlowSearchBean;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.Date;
import java.util.List;
import java.util.Optional;

public interface MonitoringCenterService {

    /**
     * 查询区域风险详情
     */
    DistrictRiskDetailBean queryDistrictRiskDetail(Pageable pageable, Long districtId, String version);

    /**
     * 风险分区列表
     *
     * @return
     */
    public DistrictInfoReturnBean queryRiskDistrictList();

    /**
     * 监测点详情( id查询)
     *
     * @param monitoringPointId 监测点ID
     * @return 监测点详情
     */
    public MonitoringPointDetailBean queryMonitoringPointDetail(Long monitoringPointId) throws ApiBusinessException;

    /**
     * 重大危险源监测详情( id查询)
     *
     * @param id 重大危险源ID
     * @return 监测详情
     */
    public MonitoringDetailsMajorHazardSourcesBean queryMajorHazardDetail(Long id);

    ResultBean alarmMessageCount(String buildId);

    /**
     * 查询当前厂区所有正在执行中的作业信息。
     * 执行中的判断标准为：1. 作业已经通过审核; 2. 作业没有验收通过
     *
     * @return
     */
    public List<BpWorkSafetyCertSimpleBean> queryAllInProgressingWorkSafetyCerts();

    List<McAlarmMessageBean> queryAlarmMessages(String type, Long riskDistrictId, Integer state, int offset, int count);

    String extranctMhAlarmContent(MhAlarmMessage one);

    /**
     * 统一处理消息
     *
     * @param type        重大危险源、风险分区、人员在岗在位,巡检排查,AI报警
     * @param id          对应消息ID
     * @param msg         备注
     * @param alarmReason 报警原因
     */
    void processAlarmMessage(String type, Long id, String msg, String alarmReason, Long handleUserId, Integer handleFlag);

    public List<NewAlarmMessage> findNewAlarmMessage();

    Page<RiskEvaluationAlarmMesage> getRiskEvaluationAlarmMesages(Long riskDistrictId, Integer state);

    void processAlarmMessageBatch(List<AlarmProcessBean> list);

    Optional<MhAlarmMessage> findById(Long id);

    MajarHazardRealtimeDataMonitoringBean majorHazardRealtimeData(Integer pageNumber, Integer pageSize);

    DeviceFacilityStatusBean getDeviceFacilityStatusBean(Long id);

    ResultBean centerRiskDistrictPage(Pageable page, CenterRiskDistrictSearchBean condition);

    ResultBean centerMajorHazardPage(Pageable page, CenterMajorHazardSearchBean condition);

    List<SimpleSelectListBean> getCenterMajorHazardTypeList();

    List<SimpleSelectListBean> getRiskDistrictLevelList();

    ResultBean workFlowScreen(WorkFlowSearchBean searchMap);

    ResultBean allColumn();

    ResultBean columnList(ScreenColumnBean screenColumnBean);

    ResultBean columnSave(ScreenColumnConfigBean bean);

    ResultBean getAllColumn();

    ScreenTypeAndConfigBean getScreenTypeList();

    List<ScreenConfigListBean> getScreenAllConfigList(Long typeId);

    ResultBean screenColumnSave(ScreenConfigListReturnBean bean);

    void processAlarmBatchAll(CenterAlarmMessageHandlerBean bean);

    ResultBean centerManuFacturingTechPage(Pageable page, String name);

    CenterManuFacturingTechBean getManuFacturingTechById(Long id);

    List<CenterEmergencyPlanBean> getPlanListByHazardId(Long hazardId);

    List<ScreenPeopleCapBean> getScreenPeopleCaps();

    ResultBean getAllfacility();

    List<MonitoringPointDetailBean.WarnInfo> getAlarmByPoint(Long id, Date startTime, Date endTime);

    void handlingHazardAlarms(List<MhAlarmMessage> mhList);

    boolean syncWorkFlow(List<InspectExceptionAlarmMesage> inspectList);
}
